from job import celery_job
from app import app

@celery_job.task()
def task_one_function(xx=1, yy=2):
    # 可以在这里
    # 实现你的异步任务的逻辑
    print(111, 222)

@celery_job.task()
def task_two_function(*args, **kwargs):
    #  实现逻辑的代码模块
    print(1111)

from ronglian_sms_sdk import SmsSDK
accId = '8a216da878005a800178a251439d39da'
accToken = 'dc4fd2e2a23e45a68474dbc6d1233eda'
appId = '8a216da878005a800178a251449839e1'


@celery_job.task(bind=True)
def send_message(self,mobile, sms_id):
    sdk = SmsSDK(accId, accToken, appId)
    tid = '1'
    datas = (sms_id,)
    try:
        resp = sdk.sendMessage(tid, mobile, datas)
    except:
        resp="-1"
    resp = eval(resp)
    
    if (resp == "-1") or (resp['statusCode'] !="000000"):
        print("尝试")
        self.retry(countdown=1,max_retries=3,exc=Exception("发送失败"))
    return resp
 

@celery_job.task()
def orders_check(order_no):
    pass
